import { Controller, Post, Param } from '@nestjs/common';
import { ApiCreatedResponse, ApiResponse, ApiTags } from '@nestjs/swagger';
import {
  RegisterDTO,
  LoginSMSDTO,
  LoginTokenDTO,
} from './model/dto/request.dto';
import { UserService } from './user.service';
import PersonEntity from './model/entity/person.entity';
import PhotoEntity from '../photo/photo.entity';
import WeaponEntity from './model/entity/weapon.entity';

@Controller()
@ApiTags('用户模块')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Post('/register')
  @ApiResponse({ type: PersonEntity })
  register(@Param() param: RegisterDTO): Promise<PersonEntity> {
    return this.userService.createPerson();
  }

  @Post('/loginWithSms')
  @ApiCreatedResponse({ type: PersonEntity })
  loginWithSms(@Param() param: LoginSMSDTO): Promise<PersonEntity> {
    return this.userService.createPerson();
  }
  @Post('/loginWithToken')
  @ApiResponse({ type: PersonEntity })
  loginWithToken(@Param() param: LoginTokenDTO): Promise<PersonEntity> {
    return this.userService.createPerson();
  }
}
